<link href="./css/style.css" rel="stylesheet" type="text/css" />
<script src="./js/jquery.js"></script>
<div class="main">
<div class="czlist">
	<p class="tt"><a>首页</a>><a>财务管理</a>><span>余额充值</span></p>
	<div class="div">
		<form class="search a">
			<p><span>会员帐号</span><input style="width:120px;" type="text" id='cardid' name="t0" value="" placeholder="会员帐号" /></p>
			<p><span>会员姓名</span><input style="width:120px;" type="text" id='name' readonly value="" placeholder="会员姓名" /></p>
			<p><span>充值类型</span>
				<select name='type'>
					<option value="0">-请选择-</option>
					<option value='1'>{$czarr[1]}</option>
					<option value='2'>{$czarr[2]}</option>
				</select>
			</p>
			<p><span>充值金额</span><input style="width:120px;" type="text" id='cash' name="t1" placeholder="充值金额" /></p>
			<p><span>充值密码</span><input style="width:120px;" type="password" name="t2" placeholder="充值密码" /></p>		
			<p><span>备注信息</span><input style="width:160px;" type="text" name="t3" placeholder="备注信息" /></p>		
			<p><button style='margin:0;' type="button" class='chongzhi'>确认充值</button></p>
		</form>
	</div>
	<script src="./js/jquery.js"></script>
	<script>
		$("#cardid").change(function(){
			cardid = $(this).val();
			if(cardid.length>7){
				$.ajax({
					type:"post",
					dataType:"json",
					url:"/Moudel.php?m=m&a=searchm",
					data:"cardid="+cardid,
					success:function(d){
						if(d[0]==0){
							alert(d[1]);
						}
						else{
							$("#name").val(d[1]);
						}
					}
				});
			}			
		});
		$(".chongzhi").on("click",function(){
			var cash = $('#cash').val();
			if(!cash){ alert('请填写充值金额');return false;}
			var msg = confirm("确认为该用户充值"+cash+" ?");
			if(msg == true){
			$.ajax({
				type:"post",
				dataType:"json",
				url:"/Moudel.php?m=m&a=cashcz",
				data:$(".a").serialize(),
				success:function(d){
					if(d[0]==0){
						alert(d[1]);
					}
					else{
						alert(d[1]);
						window.location.href='cashcz.php';
					}
				}
			});
			}
		});

	</script>
</div>
{if($page)}
<div class="div">
	<form method='GET' action="?" class='search' >	
		<p><span>用户账户</span><input type='text' name='uname' placeholder='用户账户' value="{$uname}" /></p>
		<p><span>充值类型</span>
			<select name='type'>
				<option {if($type==0)} selected {/if} value="0">-请选择-</option>
				<option {if($type==1)} selected {/if} value='1'>{$czarr[1]}</option>
				<option {if($type==2)} selected {/if} value='2'>{$czarr[2]}</option>
			</select>
		</p>
		<p><span>开始时间</span><input type='date' name='stime' value="{$stime}" /></p>		
		<p><span>结束时间</span><input type='date' name='etime' value="{$etime}" /></p>	
		
		<p><input type='submit' value='搜索' /></p>
	</form>
</div>
{/if}
<div class="cashlist">
	<div class="list">
{if($msg==0)}
		<p class='none'>未查询到资料</p>
{else}
		<table>
		<tr class="after"><th>ID</th><th>账号</th><th>姓名</th><th>类型</th><th>金额</th><th>备注</th><th>时间</th></tr>
{loop $clist $key as $list}
	<tr class="remove">
		<td>{$list[Id]}</td>
		<td>{$list[uname]}</td>
		<td>{$list[tname]}</td>
		<td>{$czarr[$list[type]]}</td>
		<td>{$list[cash]}</td>
		<td>{$list[content]}</td>
		<td>{$list[addtime]}</td>

	</tr>
{/loop}
	</table>
{$page}
{/if}
	<script src="./js/jquery.js"></script>	
	<script>
		h1 = $(".main").height();
		h2 = $(".cashlist").height();
		if(h2>h1){
			$(".main").css("height","auto");
		}
	</script>
	</div>
</div>
</div>
